
if(BUILD_INT8)
  add_definitions(-DBUILD_INT8)
  message("Build Engine as INT8")
  message("INT8_CALIBRATE_DATASET_PATH: " ${INT8_CALIBRATE_DATASET_PATH})
  configure_file(${SOLUTION_DIR}/include/fastrt/config.h.in ${SOLUTION_DIR}/include/fastrt/config.h @ONLY)
elseif(BUILD_FP16)
  add_definitions(-DBUILD_FP16)
  message("Build Engine as FP16")
else()
  message("Build Engine as FP32")
endif()


#file(GLOB_RECURSE COMMON_SRC_FILES
#  ${CMAKE_CURRENT_SOURCE_DIR}/common/utils.cpp
#  ${CMAKE_CURRENT_SOURCE_DIR}/common/calibrator.cpp
#)

find_package(CUDA REQUIRED)
include_directories(/usr/local/cuda/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${SOLUTION_DIR})
link_directories(/usr/local/cuda/lib64)
link_directories(${SOLUTION_DIR}/libs/${PROJECT_NAME})

include_directories(${TRT_ROOT_DIR}/include)
link_directories(${TRT_ROOT_DIR}/lib)

# build engine as library
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-Wall -pthread -O3")
file(GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/fastrt/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/ *.h)
#message("############# CMAKE_CURRENT_SOURCE_DIR: " ${SOURCE_FILES})
add_library(${REID_NAME} SHARED ${SOURCE_FILES})

target_include_directories(${REID_NAME}
PUBLIC
  ${CMAKE_CURRENT_SOURCE_DIR}/include
)

find_package(OpenCV)
target_include_directories(${REID_NAME}
PUBLIC
  ${OpenCV_INCLUDE_DIRS}
)

target_link_libraries(${REID_NAME} 
  nvinfer
  cudart
  ${OpenCV_LIBS}
)

install(TARGETS ${REID_NAME} LIBRARY DESTINATION ${SOLUTION_DIR}/libs/${PROJECT_NAME})
